pid <%= root %>/nginx.pid;

events {
  worker_connections  8192;
}

http {
  server {
    listen unix:/<%= root %>/tmp/backend.sock;
    listen <%= port %> ssl;
    server_name "";

    client_max_body_size 1G;

    error_page 497 = @handler;

    #ssl_certificate <%= root %>/config/blobstore_certificate.pem;
    #ssl_certificate_key <%= root %>/config/blobstore_key.pem;
    ssl_certificate <%= certificate_path %>;
    ssl_certificate_key <%= key_path %>;

    location / {
      root <%= root %>;
      client_body_temp_path <%= root %>/tmp;

      dav_methods DELETE PUT;
      create_full_put_path on;

      auth_basic "Blobstore Read";
      auth_basic_user_file <%= read_users_path %>;

      limit_except GET {
        auth_basic "Blobstore Write";
        auth_basic_user_file <%= write_users_path %>;
      }
    }

    location @handler {
      proxy_pass http://unix:/<%= root %>/tmp/backend.sock:$request_uri;
    }
  }
}
